<?php
class ActionController extends Zend_Controller_Action
{

    private $user_id;

    //list users
    

    function init () {
        $this->user_id = Zend_Auth::getInstance()->getIdentity()->id;
        
        $init = new Model_Init($this);
    }

    function indexAction () {
        $page = $this->_getParam('request');
        $model_action = new Model_Action();
        
        $friends_model = new Model_Friend();
        $friends = $friends_model->getFriendsList($this->user_id);
        
        //need for select WHERE in (a1,a2....)
        $friends_id_array = '(';
        
        foreach ($friends as $value) {
            if ($value->user_id != $this->user_id) {
                $friends_id_array .= $value->user_id . ',';
            } else {
                $friends_id_array .= $value->user_friend . ',';
            }
        }
        
        $a =  $friends_id_array[strlen($friends_id_array) - 1] = ')';
        $this->view->actions = $model_action->getActions($friends_id_array, 
        $page);
        
        $this->view->user_login = Zend_Auth::getInstance()->getIdentity()->login;
    }
}









